# Minimum required cmake version is 2.8
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
INCLUDE(CheckIncludeFiles)

# Project name is hool
PROJECT(hool)

# Debug configuration
SET(CMAKE_BUILD_TYPE Debug)

include_directories("${PROJECT_SOURCE_DIR}/libhooc")
include_directories("${PROJECT_SOURCE_DIR}/libhoo")
include_directories("${PROJECT_SOURCE_DIR}/config")

CHECK_INCLUDE_FILES("gc.h" HAVE_GC_H)
IF (NOT HAVE_GC_H)
include_directories("${PROJECT_SOURCE_DIR}/gc/include")
ENDIF(NOT HAVE_GC_H)

CHECK_INCLUDE_FILES("argtable2.h" HAVE_ARGTABLE2_H)
IF (NOT HAVE_ARGTABLE2_H)
include_directories("${PROJECT_SOURCE_DIR}/argtable2/src")
ENDIF(NOT HAVE_ARGTABLE2_H)

FIND_PROGRAM(BISON_EXECUTABLE bison doc "path to the bison executable")
IF (NOT BISON_EXECUTABLE)
	MESSAGE(SEND_ERROR "bison executable not found on path")
ENDIF (NOT BISON_EXECUTABLE)

FIND_PROGRAM(FLEX_EXECUTABLE flex doc "path to the flex executable")
IF (NOT FLEX_EXECUTABLE)
	MESSAGE(SEND_ERROR "flex executable not found on path")
ENDIF(NOT FLEX_EXECUTABLE)

CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/hoobuild.h.in" "${PROJECT_SOURCE_DIR}/config/hoobuild.h")
add_subdirectory(libhooc)
add_subdirectory(libhoo)
add_subdirectory(hooc)
